Traditional computer systems employ two main techniques to detect and respond to external events affecting the system, namely "polling" and "interrupt based".
The first technique, known as "polling", relies on the use of a controller in the form of a processor or a dedicated computer which checks for the occurrence of all possible events in the data processing system. Typical events are service requests, transmission and reception of data, error reports, and device status checks. The occurrence of a service request event, for example, indicates that one of the various devices in the data processing system requires that a certain operation be performed by the controller. The requesting device produces a request signal at its request status output port. The controller checks for the presence of a request signal at the request status output port of each device periodically to determine if any requests have been made and processes them as they occur.
Polling for device status may be used whenever the controller seeks to determine availability of some of a group of devices, such as data memory devices, to process its request. For example, the controller may require that data be stored in any one of several memory devices. Each memory device produces a signal indicating its availability. The controller polls the memory devices in the data processing system to determine which one is available for the operation. Once the controller detects that a memory device is available, by polling the device's request status output port, data transfer between the controller and the memory device is performed.
The frequency with which such polling is repeated, or the polling rate, can be selected to establish an acceptable balance between promptness of event detection and excessive consumption of the controller's time. A rapid polling rate results in timely detection of events, but at a cost of excessive consumption of controller time since the controller must spend time to frequently check for events which may not have occurred. A slower polling rate, on the other hand, decreases the promptness with which events will be detected, but offers the advantage of a corresponding reduction in the overhead of polling for a large number of possible events.
The second technique, known as "interrupt based", forces each external event to seek controller acknowledgment directly. This mode of controller operation is commonly referred to as interrupt because the controller interrupts the task it is currently performing to respond to the external event. Each device in the data processing system has access to the controller by being connected to one of the controller's interrupt ports. Upon the occurrence of an event, the device requests a desired operation from the controller by producing an interrupt signal which is supplied to the controller's interrupt port. In response to the interrupt signal the controller suspends its current activity and services the interrupt immediately. The interrupt service typically consists of executing an interrupt routine which is stored in known memory locations accessible to the controller. The controller is able to associate an interrupt signal arriving at a specific interrupt port with the memory address of a corresponding interrupt routine. This is usually accomplished by storing the initial address of the interrupt routine, known as a vector, in a reserved memory location, which is read by the controller upon the detection of the respective interrupt signal. In a data processing system where multiple interrupts representing occurrences of multiple events are likely to occur, interrupt prioritization is often established so that an interrupt will cause suspension of the system activity only if no higher priority interrupt is currently being processed.
This technique has the advantage that interrupts can be very quickly detected and serviced without the continuous overhead associated with a rapid polling rate. However, it also suffers from the disadvantage that the controller must be made capable of processing interrupts at their fastest rate of occurrence. If the controller cannot process interrupts at the fastest occurring rate, the controller time can be entirely expended on continuously processing interrupts, thereby preventing it from performing its other functions.
It is known to disable interrupts generated by certain events in the data processing system to ensure that the controller has sufficient time to perform critical system tasks such as device initialization and diagnostics. Once these operations are completed, the interrupts are reenabled and the data processing system resumes its operation.
One way to control interrupt handling is to provide an interrupt flag stored in a register inside the controller. The interrupt flag is set to one of the two predetermined values corresponding to the interrupt enabled and interrupt disabled conditions. To determine whether the specific interrupt is enabled or not, the controller checks the contents of the interrupt flag register.
It is also known to delay servicing interrupt requests for a fixed period of time to permit various devices in the data processing system to attain a required state, such as when initializing or preparing for communication with other system components. In such a system, a counter is set to count a predetermined number of clock pulses representing a corresponding period of time. During this period of time the interrupt service is disabled and the processing elements of the data processing systems, such as the controller, are able to attend to other tasks. Once the end of the time period is reached, the controller is again ready to process interrupts and the interrupt service is reenabled.
One variation on the interrupt method prevents rapidly occurring interrupts from using all of the controller's time under some circumstances. Using this method, the controller counts events occurring in a continuous sequence. The sequence of events is continuous if a new event occurs before the controller has completed processing the previous event. Once a prespecified threshold number of events in the continuous sequence, has been exceeded, the controller response to the interrupts caused by the events is disabled and a counter, set to count a clock signal, is started. When the value in the counter reaches a known threshold, corresponding to a predetermined time period, the interrupt is reenabled and subsequent servicing of interrupts can resume.
The above approaches ensure that the controller's time is not used exclusively to process interrupts caused by continuously occurring events. However, the controller is still vulnerable to events encountered singly (i.e. not in a continuous sequence) but with relatively high frequency, or in continuous groups (i.e. with each event in the continuous group occurring before the controller has completed processing the previous event in the group) numbering fewer than the prespecified threshold. Since the number of continuous events occurring successively never exceeds the threshold, the controller activity continues to be substantially dominated by interrupt servicing to the exclusion of other competing demands on the controller time.
A method of processing interrupts is desired which will not allow controller activity to be substantially dominated by interrupt servicing when interrupts occur frequently, but not continuously.